
	import java.util.ArrayList;
	import java.util.Collections;
	import java.util.Comparator;


	public class Employee implements Comparable<Employee> {
		int  id;
		String idd=""+id;
		String Name;
		String address;
		String gender;

		public String getName(){
			return Name;
		}
		public String getaddress(){
			return address;
		}
		public String getgender(){
			return gender;
		}
		public String getidd(){
			return idd;
		}
		public void setName(String name){
	            this.Name=name;
		}
		public void setaddress(String address){
	        this.address=address;
	}
		public void setgender(String gender){
	        this.gender=gender;
	}
		public void setidd(String idd){
	        this.idd=idd;
	}
		
		public Employee(String idd,String name,String address,String gender){
			this.idd=idd;
			this.Name=name;
			this.address=address;
			this.gender=gender;
			
			
			
		}
		public String toString(){
			return this.Name + this.address+this.idd; 
		}
		public int compareTo(Employee o){
			/*return Name.compareTo(o.getName());
			return address.compareTo(o.getaddress());
			return gender.compareTo(o.getgender());*/
			return idd.compareTo(o.getidd());
		}
		/*public Employee() {
			// TODO Auto-generated constructor stub
		}*/
		
	public static void main(String[] args) {
			ArrayList<Employee> eplist = new ArrayList<Employee>();
			eplist.add(new Employee("18","sachin","alre","male"));
			eplist.add(new Employee("1","sachin","blre","male"));
			eplist.add(new Employee("10","katrina","mimbai","female"));
			System.out.println("before sorting"+eplist);
			Collections.sort(eplist);
			System.out.println("after sorting"+eplist);
			aSort asort = new aSort();
			Collections.sort(eplist,asort);
			System.out.println("after sorting"+eplist);
			nSort nsort = new nSort();
			Collections.sort(eplist,nsort);
			
			
			System.out.println("after sorting"+eplist);
			
			
			
			/*Employee emp=new Employee();
			System.out.println(emp);*/
		}

	}
	class aSort implements Comparator<Employee>{
		@Override
		public int compare(Employee o1, Employee o2) {
			return o1.getaddress().compareTo(o2.getaddress());
			
		}
		
	}
	class nSort implements Comparator<Employee>{
		@Override
		public int compare(Employee o2, Employee o3) {
			return o2.getName().compareTo(o3.getName());
			
		}
		
	}


